package com.security.price.controller;

import com.security.price.model.PriceInfo;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @Author yanggld
 * @Date 2020/3/9-17:10
 */

@RestController
@RequestMapping("/price")
public class PriceInfoController {

    @GetMapping("/{id}")
    public PriceInfo getById(@PathVariable Long id,@RequestHeader String username){
        PriceInfo priceInfo = new PriceInfo();
        priceInfo.setId(id);
        priceInfo.setPrice(new BigDecimal(100));
        priceInfo.setUsername(username);
        return priceInfo;
    }

    @GetMapping("/model")
    public PriceInfo model(@RequestParam String username){
        PriceInfo priceInfo = new PriceInfo();
        priceInfo.setId(1L);
        priceInfo.setPrice(new BigDecimal(100));
        priceInfo.setUsername(username);
        return priceInfo;
    }
}
